import request from '@/utils/request';

export function getNovelList(params) {
  return request({
    url: '/novel/list',
    method: 'get',
    params
  });
}

export function getNovelDetail(id) {
  return request({
    url: `/novel/${id}`,
    method: 'get'
  });
}

export function createNovel(data) {
  return request({
    url: '/novel',
    method: 'post',
    data
  });
}

export function updateNovel(id, data) {
  return request({
    url: `/novel/${id}`,
    method: 'put',
    data
  });
}

export function deleteNovel(id) {
  return request({
    url: `/novel/${id}`,
    method: 'delete'
  });
}

export function getChapterList(params) {
  return request({
    url: '/chapter/list',
    method: 'get',
    params
  });
}

export function getChapterDetail(id) {
  return request({
    url: `/chapter/${id}`,
    method: 'get'
  });
}

export function createChapter(data) {
  return request({
    url: '/chapter',
    method: 'post',
    data
  });
}

export function updateChapter(id, data) {
  return request({
    url: `/chapter/${id}`,
    method: 'put',
    data
  });
}

export function deleteChapter(id) {
  return request({
    url: `/chapter/${id}`,
    method: 'delete'
  });
}

export function batchImportChapters(novelId, data) {
  return request({
    url: `/novel/${novelId}/chapters/batch`,
    method: 'post',
    data
  });
}

export function getCategoryList() {
  return request({
    url: '/category/list',
    method: 'get'
  });
}

export function getAuthorList() {
  return request({
    url: '/author/list',
    method: 'get'
  });
} 